package cn.codelab.springcloudalibaba.study.step04.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.http.HttpHeaders;

import java.util.UUID;

/**
 * @author Seven
 * @description 自定义Feign认证拦截器
 * @Gitee https://gitee.com/it-codelab
 * @Copyright 公众号：Seven的代码实验室
 */
public class FeignAuthRequestInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        // 业务逻辑
        String access_token = UUID.randomUUID().toString();
        requestTemplate.header(HttpHeaders.AUTHORIZATION, access_token);
    }
}
